package com.ruoyi.project.system.membershareslogan.service.impl;

import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.project.system.membershareslogan.domain.MemberShareSlogan;
import com.ruoyi.project.system.membershareslogan.mapper.MemberShareSloganMapper;
import com.ruoyi.project.system.membershareslogan.service.IMemberShareSloganService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.UUID;

/**
 * 用户分享标语Service业务层处理
 * 
 * @author LCL
 * @date 2021-10-20
 */
@Service
public class MemberShareSloganServiceImpl implements IMemberShareSloganService 
{
    @Autowired
    private MemberShareSloganMapper memberShareSloganMapper;

    /**
     * 查询用户分享标语
     * 
     * @param id 用户分享标语ID
     * @return 用户分享标语
     */
    @Override
    public MemberShareSlogan selectMemberShareSloganById(String id)
    {
        return memberShareSloganMapper.selectMemberShareSloganById(id);
    }

    /**
     * 查询用户分享标语列表
     * 
     * @param memberShareSlogan 用户分享标语
     * @return 用户分享标语
     */
    @Override
    public List<MemberShareSlogan> selectMemberShareSloganList(MemberShareSlogan memberShareSlogan)
    {
        return memberShareSloganMapper.selectMemberShareSloganList(memberShareSlogan);
    }

    /**
     * 新增用户分享标语
     * 
     * @param memberShareSlogan 用户分享标语
     * @return 结果
     */
    @Override
    public int insertMemberShareSlogan(MemberShareSlogan memberShareSlogan)
    {
        memberShareSlogan.setId(UUID.randomUUID().toString().replace("-",""));
        memberShareSlogan.setCreatedTime(new Date());
        return memberShareSloganMapper.insertMemberShareSlogan(memberShareSlogan);
    }

    /**
     * 修改用户分享标语
     * 
     * @param memberShareSlogan 用户分享标语
     * @return 结果
     */
    @Override
    public int updateMemberShareSlogan(MemberShareSlogan memberShareSlogan)
    {
        memberShareSlogan.setUpdatedTime(new Date());
        return memberShareSloganMapper.updateMemberShareSlogan(memberShareSlogan);
    }

    /**
     * 删除用户分享标语对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteMemberShareSloganByIds(String ids)
    {
        return memberShareSloganMapper.deleteMemberShareSloganByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除用户分享标语信息
     * 
     * @param id 用户分享标语ID
     * @return 结果
     */
    @Override
    public int deleteMemberShareSloganById(String id)
    {
        return memberShareSloganMapper.deleteMemberShareSloganById(id);
    }
}
